package org.blankie.model.fs;

import java.io.File;
import java.util.Collection;


/**
 *
 * @author francois.mora@blankie.org
 */
public class BlkFolder extends BlkFSResource {

    private static final long serialVersionUID = 0L;

    BlkFolder(BlkFSDriver driver, BlkFSPath path) {
        super(driver, path);
    }
    
    @Override
    public String getName() {
        File file = getId().getFile();
        return file.getName().equals("") ? file.getPath() : file.getName();
    }

    public BlkFolder getParent() {
        return getDriver().getParent(this);
    }

    public Collection<BlkFolder> getSubFolders() {
        return getDriver().getNodes(this);
    }
    
    public Collection<BlkFile> getFiles() {
        return getDriver().getLeaves(this);
    }

}
